import Mock from 'mockjs'
const domain = 'http://mockjs.com/api'

function tspList (prarms) {
  if (prarms.code === 1) {
    const data = {
      data: [{
        activeArea: '',
        activeDate: null,
        brand: 'lol',
        brandId: 'EEB89898AD5A4B819E404428D30D938C',
        city: null,
        classFlag: 'SYNCHRONIZATIONTSP',
        commandMessage: null,
        commandStatus: null,
        commandType: null,
        corpCode: 'system,liu',
        corpName: 'System',
        createDate: '2019-10-30 14:47',
        dataType: 1,
        downtime: null,
        energy: '1',
        id: 'F9FB01C3487B46528DB05E95D87B9D5A',
        makeYear: '2015',
        manufacturer: 'fdf',
        model: 'ig',
        modelCode: 'lol-ig',
        modelId: 'C9BA4F6A5A5142788CCE0085530996C5',
        modelMakeYear: '2019',
        orgId: '',
        organization: '',
        productBatch: null,
        productWeek: '',
        province: '江西省',
        saleArea: '',
        saleShop: '',
        sn: null,
        status: '0',
        systemType: '',
        transmissionType: '1',
        trimLevel: '12',
        updateDate: null,
        vehStyle: 'two',
        vin: '123456899ffffffff',
        vipFlag: null
      }],
      end: 10,
      pageNo: 1,
      pageSize: 10,
      start: 0,
      totalPage: 1,
      totalRow: 4
    }
    return data
  // eslint-disable-next-line no-else-return
  } else {
    const data = {
      data: [{
        activeArea: '',
        activeDate: null,
        brand: 'lol',
        brandId: 'EEB89898AD5A4B819E404428D30D938C',
        city: null,
        classFlag: 'SYNCHRONIZATIONTSP',
        commandMessage: null,
        commandStatus: null,
        commandType: null,
        corpCode: 'system,liu',
        corpName: 'System111',
        createDate: '2019-10-30 14:47',
        dataType: 1,
        downtime: null,
        energy: '1',
        id: 'F9FB01C3487B46528DB05E95D87B9D5A',
        makeYear: '2015',
        manufacturer: 'fdf',
        model: 'ig',
        modelCode: 'lol-ig',
        modelId: 'C9BA4F6A5A5142788CCE0085530996C5',
        modelMakeYear: '2019',
        orgId: '',
        organization: '',
        productBatch: null,
        productWeek: '',
        province: '江',
        saleArea: '',
        saleShop: '',
        sn: null,
        status: '0',
        systemType: '',
        transmissionType: '1',
        trimLevel: '12',
        updateDate: null,
        vehStyle: 'two',
        vin: '0000000',
        vipFlag: null
      }],
      end: 10,
      pageNo: 1,
      pageSize: 10,
      start: 0,
      totalPage: 1,
      totalRow: 4
    }
    return data
  }
}

Mock.mock(`${domain}/tsp/list`, 'post', tspList)
